import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
// 创建store实例对象

const store = new Vuex.Store({
    state: {
        routes: [],
    },
    mutations: {
        setRoutes(state, routes) {
            state.routes = routes;
        },
    },
    actions: {
        setRoutesAsync(context, routes) {
            context.commit('setRoutes', routes);
        },
    },
    getters: {
        // 相当于计算属性
        getRputes(state) {
            return state.routes;
        },
    },
});
export default store;
